package com.sunny.design.decorator.login;

/**
 * @author Sunny
 * @date 2020/1/12
 */
public class SignInForThirdService implements ISignInForThirdService {

    private ISignInService signInService;

    public SignInForThirdService(ISignInService signInService) {
        this.signInService = signInService;
    }

    @Override
    public ResultMsg loginForQQ(String openId) {
        LoginForQQDecorator loginForQQDecorator = new LoginForQQDecorator(this.signInService);
        return loginForQQDecorator.login(openId);
    }

    @Override
    public ResultMsg loginForWeChat(String openId) {
        LoginForWeChatDecorator loginForWeChatDecorator = new LoginForWeChatDecorator(this.signInService);
        return loginForWeChatDecorator.login(openId);
    }

    @Override
    public ResultMsg loginForToken(String token) {
        LoginForTokenDecorator loginForTokenDecorator = new LoginForTokenDecorator(this.signInService);
        return loginForTokenDecorator.login(token);
    }

    @Override
    public ResultMsg loginForTelephony(String telephony, String code) {
        LoginForTelephonyDecorator loginForTelephonyDecorator = new LoginForTelephonyDecorator(this.signInService);
        return loginForTelephonyDecorator.login(telephony, code);
    }

    @Override
    public ResultMsg loginForRegister(String username, String password) {
        this.signInService.register(username, password);
        return this.signInService.login(username, password);
    }

    @Override
    public ResultMsg login(String username, String password) {
        return this.signInService.login(username, password);
    }

    @Override
    public ResultMsg register(String username, String password) {
        return this.signInService.register(username, password);
    }
}
